<template>
	<view :class="{popupShow:popupShow}" style="padding-top: 180rpx;">
		<u-navbar
				          title="搜索"
				          :autoBack="true"
				      >
				      </u-navbar>
		<my-search></my-search>
		<view v-show="topSearchButton == 1">
			<hosp-list></hosp-list>
		</view>
		<view v-show="topSearchButton == 2">
			<dep-list></dep-list>
		</view>
		<view v-show="topSearchButton == 3">
			<doc-list></doc-list>
		</view>
	</view>
</template>

<script>
	import {
		mapGetters,
		mapMutations,
		mapActions,
		mapState
	} from "vuex";
	import {
		searchNav
	} from '@/api/home/search.js'
	export default {
		provide() {
			return {
				scroll: this //必须这样传才是响应式
			}
		},
		data() {
			return {
				scrollLength: 0,
			}
		},
		methods: {
			...mapMutations([ 'ADDHIS', 'ALLRESET','NODATA']),
			onReachBottom() {
				if(this.hasHaoFlag == 1){
					this.ADDHIS('roll')
					return
				}
				if(this.hasHaoFlag == 2){
					this.NODATA('roll')
					return
				}
			},
		},
		computed: {
			...mapState({
				topSearchButton: state => state.doc.topSearchButton,
				hasHaoFlag : state => state.doc.hasHaoFlag,
			}),
			popupShow(){
				return this.$store.state.doc.popupShow
			}
		},
		watch: {
		},
		// onLoad(params) {
		// 	console.log(params)
		// },
		async onShow() {
			// my.setNavigationBar({
			// 	title: '搜索'
			// })
			this.$store.state.doc.popupShow = false //冻结背景滑动
		},
		onPageScroll(e) { //nvue暂不支持滚动监听，可用bindingx代替,滚动距离
			if(!this.popupShow){
				this.$store.state.doc.ResultTopHight = e.scrollTop
				this.scrollLength = e.scrollTop
			}
			//console.log("滚动距离为：" + e.scrollTop);
		},
		onLoad() {
			this.ALLRESET() //重置
		}
	}
</script>

<style lang="scss" scoped>
.popupShow{
		position: fixed;
		overflow: hidden;
		top: 180	}
</style>